package com.itehima.Function;

import java.util.ArrayList;
import java.util.Arrays;

public class Prac02 {
    public static void main(String[] args) {

          //创建学生对象，只提取姓名部分存储到字符串数组中
        ArrayList<Student> list=new ArrayList<>();
        list.add(new Student("zhangsan",23));
        list.add(new Student("lisi",24));
        list.add(new Student("wangwu",25));

        String[] newarr = list.stream().map(Student::getName).toArray(String[]::new);
        System.out.println(Arrays.toString(newarr));

    }
}
